#ifndef __MARS_GRAPHICS_INPUTLAYOUT_H__
#define __MARS_GRAPHICS_INPUTLAYOUT_H__

namespace Graphics
{

class VertexShader;

class InputLayout
{
public:
									InputLayout();
									~InputLayout();
	
	void							AddElement( const char*					pSemanticName, 
												Core::uint32				iSemanticIndex, 
												DXGI_FORMAT					format, 
												Core::uint32				iSlot, 
												Core::uint32				iOffset, 
												D3D11_INPUT_CLASSIFICATION	iClassification,
												Core::uint32				iInstanceDataStepRate);

	bool							Bind( VertexShader& vertexShader );
	bool							IsBind() const;

	ID3D11InputLayout*				GetNativeInputLayout();

private:
	ID3D11InputLayout*						m_pInputLayout;
	std::vector<D3D11_INPUT_ELEMENT_DESC>	m_vElements;
	VertexShader*							m_pVertexShader;
};

inline InputLayout::InputLayout()
	: m_pInputLayout( NULL )
	, m_pVertexShader( NULL )
{

}

inline InputLayout::~InputLayout()
{
	SAFE_RELEASE( m_pInputLayout );
}

inline bool InputLayout::IsBind() const
{
	return ( m_pVertexShader != NULL );
}

inline ID3D11InputLayout* InputLayout::GetNativeInputLayout()
{
	return m_pInputLayout;
}

} // end of namespace Graphics

#endif // end of #ifndef __MARS_GRAPHICS_INPUTLAYOUT_H__